<template>
	<div class="feedback-box">
		<el-table :data="tableData" stripe style="width: 100%" class="feedback-table1">
			<el-table-column prop="feedbackTitle" :label="$t('message.table.title1')" width="400"> </el-table-column>
			<el-table-column prop="feedbackClassification" :label="$t('message.table.title9')" width="180"> </el-table-column>
			<el-table-column prop="name" :label="$t('message.table.title3')"> </el-table-column>
			<el-table-column prop="feedbackAddtime" :label="$t('message.table.title4')"> </el-table-column>
			<el-table-column fixed="right" :label="$t('message.table.title5')" width="180">
				<template slot-scope="scope">
					<el-button @click="handleClick(scope.row)" type="text" size="small">{{ $t('message.table.title6') }}</el-button>
					<el-button type="text" size="small">{{ $t('message.table.title7') }}</el-button>
				</template>
			</el-table-column>
		</el-table>
		<div class="page">
			<el-pagination
				@size-change="handleSizeChange"
				@current-change="handleCurrentChange"
				:current-page="pageInfo.pagenum"
				:page-sizes="[8, 12, 16, 20]"
				:page-size="pageInfo.pagesize"
				layout="total, sizes, prev, pager, next, jumper"
				:total="total"
			>
			</el-pagination>
		</div>
	</div>
</template>

<script>
import { Session } from '@/utils/storage';
import { getMyFeedback } from '@/api/feedbackModular/index.js';
export default {
	name: 'myFeedback',
	data() {
		return {
			tableData: [],
			pageInfo: {
				// 当前页码
				pagenum: 1,
				// 每页显示条数
				pagesize: 8,
			},
			total: 0,
			// 分页查询数据
			searchKey: {
				id:Session.get('userInfo').otherInfo.id,
				pagenum:'',
				pagesize:''
			}
		};
	},
	created() {
		this.getMyFeedbackInfo();
	},
	methods: {
		async getMyFeedbackInfo() {
			this.searchKey.pagenum = this.pageInfo.pagenum
			this.searchKey.pagesize = this.pageInfo.pagesize
			let res = await getMyFeedback(this.searchKey);
			if (res.statusCode === 20000) {
				this.tableData = res.data.records;
				this.total = res.data.total
			}
		},
		handleSizeChange(val) {
			// this.flag = false;
			this.pageInfo.pagesize = val;
			this.getMyFeedbackInfo();
			// setTimeout(this.isTrue, 200);
		},
		handleCurrentChange(val) {
			// this.flag = false;
			this.pageInfo.pagenum = val;
			this.getMyFeedbackInfo();
			// setTimeout(this.isTrue, 200);
		},
		handleClick(e) {
			console.log(e);
		},
	},
};
</script>

<style lang="scss" scoped>
.feedback-box {
	@for $i from 1 through 1 {
		.feedback-table#{$i} {
			opacity: 0;
			animation-name: error-num;
			animation-duration: 0.5s;
			animation-fill-mode: forwards;
			animation-delay: calc($i/10) + s;
		}
	}
}
</style>